<?php 
 // echo "http://" . $_SERVER['HTTP_HOST'] ;
 // exit;
session_start();
define( '_JEXEC', 1 );
define('PATH_BASE', dirname(__FILE__) );
define( 'DS', DIRECTORY_SEPARATOR );
$parts = explode( DS, PATH_BASE );
define( 'PATH_ROOT_ADMIN',			implode( DS, $parts ) );
define('BASE_URL', 'http://localhost/ob_start/');


// echo PATH_ROOT_ADMIN;
require_once('../libs/db_connect.php'); 
require_once ( '../libs/hamhaydung.php' );

	if(!isset($_SESSION['hotenadmin']))
	{			
		$linklogin = BASE_URL.'admin/modules/login.php';
		header("Location: $linklogin");
		exit;
	}
			
 ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
	<title>Quản trị</title>
	<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
	<script type="text/javascript" src="<?php echo BASE_URL . 'admin/js/jquery-1.8.0.min.js'; ?>"></script>
	<script type="text/javascript" src="<?php echo BASE_URL . 'admin/js/ajax.js'; ?>"></script>
	<script type="text/javascript" src="<?php echo BASE_URL?>libs/ckeditor/ckeditor.js"></script>
	<script type="text/javascript" src="<?php echo BASE_URL?>libs/ckfinder/ckfinder.js"></script>
	
	
	
	<script>
		var baseurl = "<?php echo BASE_URL ?>";
	</script>
</head>
<body>
<!-- Header -->
<div id="header">
	<div class="shell">
		<!-- Logo + Top Nav -->
		<div id="top">
			<h1><a href="#">Quản Trị website</a></h1>
			<div id="top-navigation">
				Welcome <strong>Administrator</strong>
				<span>|</span>				
				<a onclick="return confirm('Bạn có chắc chắn muốn đăng xuất không !!! ');" href="<?php echo BASE_URL.'admin/modules/dangxuat.php'?>">Đăng xuất</a>
				<span>|</span>	
				<a href="<?php echo BASE_URL?>" target="_blank">Xem trang chủ</a>
			</div>
		</div>
		<!-- End Logo + Top Nav -->			
		
		<!-- Main Nav -->		

<?php
$activemenu = $_GET['action'];
$classbaiviet='';
$classsanpham='';
$classquanlychucnang='';
$classnguoidung='';
$classcauhinh='';
$classbangdieukhien='';
switch ($activemenu)
{
	case 'content' : 
	case 'content_sua' : 
	$classbaiviet='class="active"';
	break;
	
	case 'params' : 
	case 'params_sua' : 
	$classquanlychucnang='class="active"';
	break;

	case 'sanpham' : 
	case 'sanpham_sua' : 
	case 'sanpham_loai' : 
	case 'sanpham_loai_sua' : 
	case 'sanpham_danhmuc' : 
	case 'sanpham_danhmuc_sua' : 
	$classsanpham='class="active"';
	break;
	
	default : $classbangdieukhien='class="active"';
}
?>


		
		<div id="navigation" >
			<ul>
			    <li>
					<a href="?action=wellcome" <?php echo $classbangdieukhien?> ><span>Bảng điều khiển</span></a>
				</li>
				
			    <li>
					<a href="?action=content"  <?php echo $classbaiviet?> ><span>Bài viết</span></a>
					<ul class="child_top_menu">
						<li><a href="?action=content_sua&id=0">Thêm bài viết</a></li>
						<li><a href="?action=content">Quản lý bài viết</a></li>
					</ul>
				</li>
					
				<li>
					<a href="?action=sanpham" <?php echo $classsanpham?> ><span>Sản phẩm</span></a>
					<ul class="child_top_menu">
						<li><a href="index.php?action=sanpham_sua&id=0">Thêm sản phẩm</a></li>
						<li><a href="?action=sanpham">Quản lý sản phẩm</a></li>
						<li><a href="?action=sanpham_danhmuc">Quản lý danh mục</a></li>
						<li><a href="?action=sanpham_loai">Quản lý loại</a></li>
					</ul>
				</li>	
				
				<li>
					<a href="?action=params" <?php echo $classquanlychucnang?> ><span>Quản lý chức năng</span></a>					
				</li>	

				<li>
					<a href="#" <?php echo $classnguoidung?> ><span>Người dùng</span></a>
					<ul class="child_top_menu">
						<li><a href="#">Thêm người dùng</a></li>
						<li><a href="#">Quản lý người dùng</a></li>
						<li><a href="#">Đổi mật khẩu</a></li>
					</ul>
				</li>

				<li>
					<a href="#" <?php echo $classcauhinh?> ><span>Cấu hình</span></a>
					<ul class="child_top_menu">
						<li><a href="#">Thêm chủ đề</a></li>
						<li><a href="#">Thêm danh mục</a></li>
						<li><a href="#">Thêm menu</a></li>
						<li><a href="#">Thêm module</a></li>
					</ul>
				</li>	
				
			</ul>
		</div>
		<!-- End Main Nav -->
	</div>
</div>
<!-- End Header -->

			<?php 
				$action=@$_GET['action'];
				if($action=="") 
				$action='wellcom';
				$fileaction='modules/'.$action.'.php';
				
				if (file_exists($fileaction)) {			
					require($fileaction);
				}else{
					include('modules/wellcom.php');
				}
			?>

<!-- Footer -->
<div id="footer">
	<div class="shell">
		<span class="left">&copy; 2013 - tencongty.com</span>
		<span class="right">
			Thiết kế bởi <a href="http://webdungsan.com" target="_blank" title="web dung san">webdungsan.com</a>
		</span>
	</div>
</div>
<!-- End Footer -->
	
</body>
</html>